const i18next = require('i18next');
const Backend = require('i18next-http-backend');
const middleware = require('i18next-http-middleware');
const path = require('path')
const outerFolderPath = path.resolve(__dirname, '..')

i18next.use(middleware.LanguageDetector)
.use(Backend)
.init({
  resources: {
    en: {
      common: require('./locales/en/common.json'),
      brands: require('./locales/en/brands.json'),
      series: require('./locales/en/series.json'),
      model: require('./locales/en/models.json')
    },
    zh: {
      common: require('./locales/zh/common.json'),
      brands: require('./locales/zh/brands.json'),
      series: require('./locales/zh/series.json'),
      model: require('./locales/zh/models.json')
    }
  },
  defaultNS: 'common',
  fallbackLng: 'zh',
});

module.exports = i18next;